package srv

import (
	"background/internal/model/back/repo"
	"background/utilx/cachex"
	"sync"
)

var lock = &sync.Mutex{} //互斥锁

var singleCloudOrder *MusicSong

func NewSong(db repo.CloudRepo, bucket cachex.RedisBucket) MusicSong {
	if singleCloudOrder == nil {
		lock.Lock()
		defer lock.Unlock()
		if singleCloudOrder == nil {
			return newSong(db, bucket)
		}
	}
	return *singleCloudOrder
}
